package com.metacube.metaconnect.model;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class ActivationForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String email;
	private String domains;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDomains() {
		return domains;
	}

	public void setDomains(String domains) {
		this.domains = domains;
	}

	/*
	 * validates email Of SignUp form before sending Activation Mail
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();

		try {
			// if email is blank
			if (email.trim().equals("")) {
				request.setAttribute("signupError", "emailBlank");
				errors.add("email",
						new ActionMessage("MetaConnect.error.email"));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return errors;
	}
}
